<%@ page import="com.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

    <%
        User user = new User(1001,"admin","123","123@qq.com");
        //将登录成功的用户信息存储在session中
        session.setAttribute("user", user);
    %>

    <%
        User userBySession = (User) session.getAttribute("user");
        if(userBySession == null){
    %>
        <%--未登录--%>
        <a href="">登录</a>
        <a href="">注册</a>
    <%
        }else{
    %>
        <%--已登录--%>
        欢迎您，<%=userBySession.getUsername()%>
    <%
        }
    %>




</body>
</html>
